# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=phpspy
pkgver=0.5.0
pkgrel=1
pkgdesc="Low-overhead sampling profiler for PHP 7 "
url="https://github.com/adsr/phpspy"
arch="all"
license="MIT"
depends="perl"
makedepends="linux-headers termbox-dev"
checkdepends="ncurses bash grep php7 procps"
options="!check" # require ptrace capability and checkroot is not enough
source="$pkgname-$pkgver.tar.gz::https://github.com/adsr/phpspy/archive/v$pkgver.tar.gz
	libpthread.patch
	remove-termbox-check.patch
	fix-install.patch
	"

build() {
	make phpspy_dynamic
}

package() {
	make prefix="/usr" DESTDIR="$pkgdir" install
	install -D -v -m 755 stackcollapse-phpspy.pl \
		"$pkgdir"/usr/bin/stackcollapse-phpspy
	install -D -v -m 755 vendor/flamegraph.pl \
		"$pkgdir"/usr/bin/flamegraph-phpspy
}

sha512sums="7163a9f0a44a7dc94e9b722b403218154a27992ba4bfcdae936bdc197b8bc732f70f506318540f356467acdbfec1b0ebc868409010d367a51c056790ab81be1f  phpspy-0.5.0.tar.gz
e3a6a0d3943c588570406e13155671fc9e16141e202aada9178681ea2afdc98698f54120a499aab85b82f5de1d25a30afe5cea1209fc2cc7f3da6cf4486dd3b5  libpthread.patch
c07a0e9df74dc16fc51445ddc9321314d131049ac0acc3ab7aab76907f05ab78cd3e8fd55e5db14a43e66568ca19f7006369d3f9bf8c09e122a57a58513d071c  remove-termbox-check.patch
0d7a53a77fc6b8d191eb873af29771e520b8119357ceda0a81ad710a6d365812be3d4e87c3863d34ee14059a355626ba5dce507607ec7434aed4198bafb33ac3  fix-install.patch"
